import request from "@/utils/request";
export default {
  // Page 查询所有
  getTeacherListPage(page, pageSize, teacherQuery) {
    return request({
      // 地址
      url: `/Learning/teacher/page/${page}/${pageSize}`,
      //请求方式
      method: "post",
      // 因为是后端json方法响应回来数据
      data: teacherQuery
    });
  },
  // 删除讲师
  deleteTeacherId(id) {
    return request({
      url: `/Learning/teacher/delete/${id}`,
      method: "delete"
    });
  },

  // 通过id查找
  selectThisTeacher(id) {
    return request({
      url: `/Learning/teacher/getThisTeacher/${id}`,
      method: "get"
    });
  },

  // 修改
  editTeacher(teacher) {
    //用teacher参数来接收后端传过来的teacher对象
    return request({
      //通过request把前端的数据给了后端//然后再把返回来的结果定义到data中
      url: `/Learning/teacher/editTeacher/`,
      method: "post",
      data: teacher //在后端指定了data中key为teacher vuale为对象数据
    });
  },
  // 添加
  saveTeacher(teacher) {
    return request({
      url: `/Learning/teacher/addTeacher/`,
      method: "post",
      data: teacher
    });
  }
};
